package com.golxen.framework.user.player;


import com.golxen.framework.user.dao.entity.UserInfo;
import com.golxen.protojava.PlayerProto;


public class PlayerPb {
	public static PlayerProto.PlayerBaseTempMsg.Builder parsePlayerBaseTempMsg(UserInfo userInfo){
		PlayerProto.PlayerBaseTempMsg.Builder msg = PlayerProto.PlayerBaseTempMsg.newBuilder();
		msg.setUserId(userInfo.getUserId());
		msg.setNickName(userInfo.getNickName());
		msg.setRegisterTime(userInfo.getRegisterTime());
		GamePlayer onlinePlayer = GamePlayerMgr.getOnlinePlayer(userInfo.getUserId());
		if (onlinePlayer != null) {
		    msg.setLastLoginTime(0);    
		} else  {
		    msg.setLastLoginTime(userInfo.getLastLoginTime());
		}
		return msg;
	}
}
